package com.dragonwu.controller;

import com.dragonwu.feign.TestServiceFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author DragonWu
 * @date 2022-10-01 11:10
 **/
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TestServiceFeign testServiceFeign;

    @GetMapping("/hello")
    public String hello() {
        return "hello";
    }

    @GetMapping("/how")
//    @SentinelResource(value = "howAreYou", blockHandlerClass = TestController.class, blockHandler = "youBlock")
    public String howAreYou() {
        return "how old are you?";
    }
//
//    public static String youBlock(BlockException e) {
//        return "你完了";
//    }

    @GetMapping("/test")
    public String test() throws Exception{
        return testServiceFeign.test01("hello");
    }
}
